statefiles: fix stale pio handling for !ubus
authorDavid Härdeman <[email protected]>
Sun, 30 Nov 2025 22:13:39 +0000 (23:13 +0100)
committerÁlvaro Fernández Rojas <[email protected]>
Tue, 9 Dec 2025 15:38:32 +0000 (16:38 +0100)
commit5203ad13954c28377fc4f0ffb7bfd2cf501303bb
treeb63d8ce00c69eca944311382245c8e56171376a0
parenta64760b30f67eee8f64d3a06790216de5e49b038
statefiles: fix stale pio handling for !ubus

Currently, config.c:odhcpd_reload() will call:
set_config()
// the piodir is set here
set_interface()
config_parse_interface()
statefiles_read_prefix_information()
statefiles_setup_dirfd()
ubus_apply_network()
config_parse_interface()
statefiles_read_prefix_information()

This works when ubus is enabled, because of the extra call to
ubus_apply_network() which will read the pio file after the
dirfd has been set up.

However, it won't work when ubus isn't enabled since it'll
turn ubus_apply_network() into a noop.

Fix this by moving the statefiles_setup_dirfd() calls into
set_config(), i.e. setup the dirfds as soon as the relevant
cfg options have been read.

Signed-off-by: David Härdeman <[email protected]>
Link: https://github.com/openwrt/odhcpd/pull/333
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
src/config.c